package com.example.controller;

import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import com.example.service.StatisticsService;

import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;

/**
 * Created by douyx on 2017/11/13.
 */
@RestController
public class StatisticsController {

	@Autowired
	private StatisticsService statisticsService;

	@ApiOperation(value = "辖区内电梯各项统计", notes = "辖区内电梯各项统计")
	@RequestMapping(value = "api/statistics/countEle/{id}", method = RequestMethod.POST)
	Map<String, Object> countEle(@PathVariable String id) {
		return statisticsService.countEleNum(id);
	}

	@ApiOperation(value = "辖区内电梯数量分布", notes = "辖区内电梯数量分布")
	@ApiImplicitParam(name = "id", value = "机构编号", dataType = "Long", required = true)
	@RequestMapping(value = "api/statistics/countNumDistrib/{id}", method = RequestMethod.POST)
	Map<String, Object> countNumDistrib(@PathVariable String id) {
		return statisticsService.countNumDistrib(id);
	}

	@ApiOperation(value = "辖区内电梯类型分布", notes = "辖区内电梯类型分布")
	@RequestMapping(value = "api/statistics/countTypeDistrib", method = RequestMethod.POST)
	Map<String, Object> countTypeDistrib() {
		return statisticsService.countTypeDistrib();
	}

	@ApiOperation(value = "辖区内电梯年限分布", notes = "辖区内电梯年限分布")
	@RequestMapping(value = "api/statistics/countYearDistrib", method = RequestMethod.POST)
	Map<String, Object> countYearDistrib(@RequestBody Map map) {
		return statisticsService.countYearDistrib(map);
	}

	@ApiOperation(value = "辖区内保障力量分布", notes = "辖区内保障力量分布")
	@RequestMapping(value = "api/statistics/countOperDistrib", method = RequestMethod.POST)
	Map<String, Object> countOperDistrib(@RequestBody Map map) {
		return statisticsService.countOperDistrib(map);
	}

	@ApiOperation(value = "辖区内各项安全状况统计", notes = "辖区内各项安全状况统计")
	@RequestMapping(value = "api/statistics/countSafeNum", method = RequestMethod.POST)
	Map<String, Object> countSafeNum() {
		return statisticsService.countSafeNum();
	}

	@ApiOperation(value = "电梯安全保障工作落实情况", notes = "电梯安全保障工作落实情况")
	@RequestMapping(value = "api/statistics/countMaintRepairNum", method = RequestMethod.POST)
	Map<String, Object> countMaintRepairNum() {
		return statisticsService.countMaintRepairNum();
	}

	@ApiOperation(value = "电梯事故隐患排除情况", notes = "电梯事故隐患排除情况")
	@ApiImplicitParam(name = "id", value = "机构编号", dataType = "Long", required = true)
	@RequestMapping(value = "api/statistics/countRepairNum/{id}", method = RequestMethod.POST)
	Map<String, Object> countRepairNum(@PathVariable String id) {
		return statisticsService.countRepairNum(id);
	}

	@ApiOperation(value = "电梯安全保障工作超期情况", notes = "电梯安全保障工作超期情况")
	@ApiImplicitParam(name = "id", value = "机构编号", dataType = "Long", required = true)
	@RequestMapping(value = "api/statistics/countMaintNum/{id}", method = RequestMethod.POST)
	Map<String, Object> countMaintNum(@PathVariable String id) {
		return statisticsService.countMaintNum(id);
	}

	@ApiOperation(value = "获取年度统计数据", notes = "获取年度统计数据")
	@ApiImplicitParams({
		@ApiImplicitParam(name = "id", value = "机构编号", required = true, dataType = "String"),
		@ApiImplicitParam(name = "year", value = "年份", required = true, dataType = "String") })
	@RequestMapping(value = "api/statistics/countQuartz", method = RequestMethod.POST)
	Map<String, Object> countQuartz(@RequestBody Map<String, Object> param) {
		return statisticsService.countQuartz(param);
	}

	@ApiOperation(value = "记录检验超期电梯信息", notes = "记录检验超期电梯信息")
	@ApiImplicitParams({
		@ApiImplicitParam(name = "elevatorId", value = "电梯编号", required = true, dataType = "String"),
		@ApiImplicitParam(name = "date", value = "当前检测日期", required = true, dataType = "String") })
	@RequestMapping(value = "api/statistics/recordOvertimeEle", method = RequestMethod.POST)
	Map<String, Object> recordOvertimeEle(@RequestBody Map<String, Object> param) {
		return statisticsService.recordOvertimeEle(param);
	}

	@ApiOperation(value = "辖区内电梯的总数量(物业)", notes = "辖区内电梯的总数量(物业)")
	@ApiImplicitParam(name = "id", value = "机构编号", dataType = "Long", required = true)
	@RequestMapping(value = "api/statistics/countEleNum/{id}", method = RequestMethod.POST)
	Map<String, Object> countElevatorNum(@PathVariable String id) {
		return statisticsService.countElevatorNum(id);
	}

	@ApiOperation(value = "辖区内电梯的总数量(维保)", notes = "辖区内电梯的总数量(维保)")
	@ApiImplicitParam(name = "id", value = "机构编号", dataType = "Long", required = true)
	@RequestMapping(value = "api/statistics/countEleMaintNum/{id}", method = RequestMethod.POST)
	Map<String, Object> countEleMaintNum(@PathVariable String id) {
		return statisticsService.countEleMaintNum(id);
	}

	@ApiOperation(value = "不同类型电梯数量占比", notes = "不同类型电梯数量占比")
	@ApiImplicitParam(name = "id", value = "机构编号", dataType = "Long", required = true)
	@RequestMapping(value = "api/statistics/countEleTypeNum/{id}", method = RequestMethod.POST)
	Map<String, Object> countEleTypeNum(@PathVariable String id) {
		return statisticsService.countEleTypeNum(id);
	}

	@ApiOperation(value = "使用年限达10年以上电梯数量", notes = "使用年限达10年以上电梯数量")
	@ApiImplicitParam(name = "id", value = "机构编号", dataType = "Long", required = true)
	@RequestMapping(value = "api/statistics/countLifeOlder/{id}", method = RequestMethod.POST)
	Map<String, Object> countEleLifeNumOlder(@PathVariable String id) {
		return statisticsService.countEleLifeNumOlder(id);
	}

	@ApiOperation(value = "使用年限达10年以下电梯数量", notes = "使用年限达10年以下电梯数量")
	@ApiImplicitParam(name = "id", value = "机构编号", dataType = "Long", required = true)
	@RequestMapping(value = "api/statistics/countLifeYounger/{id}", method = RequestMethod.POST)
	Map<String, Object> countEleLifeNumYounger(@PathVariable String id) {
		return statisticsService.countEleLifeNumYounger(id);
	}

	@ApiOperation(value = "本帐户辖区维保单位数量", notes = "本帐户辖区维保单位数量")
	@ApiImplicitParam(name = "id", value = "机构编号", dataType = "Long", required = true)
	@RequestMapping(value = "api/statistics/countMaintCompany/{id}", method = RequestMethod.POST)
	Map<String, Object> countMaintCompany(@PathVariable String id) {
		return statisticsService.countMaintCompany(id);
	}

	@ApiOperation(value = "本帐户辖区使用单位数量", notes = "本帐户辖区使用单位数量")
	@ApiImplicitParam(name = "id", value = "机构编号", dataType = "Long", required = true)
	@RequestMapping(value = "api/statistics/countUseCompany/{id}", method = RequestMethod.POST)
	Map<String, Object> countUseCompany(@PathVariable String id) {
		return statisticsService.countUseCompany(id);
	}

	@ApiOperation(value = "各单位 资质 数量 及 占比", notes = "各单位 资质 数量 及 占比")
	@ApiImplicitParam(name = "id", value = "机构编号", dataType = "Long", required = true)
	@RequestMapping(value = "api/statistics/countCompanyQuali/{id}", method = RequestMethod.POST)
	Map<String, Object> countCompanyQuali(@PathVariable String id) {
		return statisticsService.countCompanyQuali(id);
	}

	@ApiOperation(value = "各星级 维保单位总数及占比", notes = "各星级 维保单位总数及占比")
	@ApiImplicitParam(name = "id", value = "机构编号", dataType = "Long", required = true)
	@RequestMapping(value = "api/statistics/countStarCompany/{id}", method = RequestMethod.POST)
	Map<String, Object> countStarCompany(@PathVariable String id) {
		return statisticsService.countStarCompany(id);
	}

	@ApiOperation(value = "本帐户辖区安全责任主体单位各类型技术人员持证数量", notes = "本帐户辖区安全责任主体单位各类型技术人员持证数量")
	@ApiImplicitParam(name = "id", value = "机构编号", dataType = "Long", required = true)
	@RequestMapping(value = "api/statistics/countTechmanCompany/{id}", method = RequestMethod.POST)
	Map<String, Object> countTechmanCompany(@PathVariable String id) {
		return statisticsService.countTechmanCompany(id);
	}

	@ApiOperation(value = "乘客投诉处理的反馈 率", notes = "乘客投诉处理的反馈 率")
	@ApiImplicitParam(name = "id", value = "机构编号", dataType = "Long", required = true)
	@RequestMapping(value = "api/statistics/countFeedbackRio/{id}", method = RequestMethod.POST)
	Map<String, Object> countFeedbackRio(@PathVariable String id) {
		return statisticsService.countFeedbackRio(id);
	}

	@ApiOperation(value = "本帐户辖区整体维保准时率、各类型周期性维保的平均时长", notes = "本帐户辖区整体维保准时率、各类型周期性维保的平均时长")
	@ApiImplicitParam(name = "id", value = "机构编号", dataType = "Long", required = true)
	@RequestMapping(value = "api/statistics/countMaint/{id}", method = RequestMethod.POST)
	Map<String, Object> countMaint(@PathVariable String id) {
		return statisticsService.countMaint(id);
	}

	@ApiOperation(value = "(按月)本帐户辖区周期内整体召修/维修落实率", notes = "(按月)本帐户辖区周期内整体召修/维修落实率")
	@ApiImplicitParam(name = "id", value = "机构编号", dataType = "Long", required = true)
	@RequestMapping(value = "api/statistics/countRepair/{id}", method = RequestMethod.POST)
	Map<String, Object> countRepair(@PathVariable String id, String reportDate) {
		return statisticsService.countRepair(id, reportDate);
	}

	@ApiOperation(value = "本帐户辖区周期内现场应急救援累计数", notes = "本帐户辖区周期内现场应急救援累计数")
	@ApiImplicitParam(name = "id", value = "机构编号", dataType = "Long", required = true)
	@RequestMapping(value = "api/statistics/countRescue/{id}", method = RequestMethod.POST)
	Map<String, Object> countRescue(@PathVariable String id) {
		return statisticsService.countRescue(id);
	}

	@ApiOperation(value = "使用单位（物业）应急救援演练总次数", notes = "使用单位（物业）应急救援演练总次数")
	@ApiImplicitParam(name = "id", value = "机构编号", dataType = "Long", required = true)
	@RequestMapping(value = "api/statistics/countRescueDrill/{id}", method = RequestMethod.POST)
	Map<String, Object> countRescueDrill(@PathVariable String id) {
		return statisticsService.countRescueDrill(id);
	}

	@ApiOperation(value = "检验机构数量", notes = "检验机构数量")
	@ApiImplicitParam(name = "id", value = "机构编号", dataType = "Long", required = true)
	@RequestMapping(value = "api/statistics/countCheckOrgNum/{id}", method = RequestMethod.POST)
	Map<String, Object> countCheckOrgNum(@PathVariable String id) {
		return statisticsService.countCheckOrgNum(id);
	}

	@ApiOperation(value = "人员数量", notes = "人员数量")
	@ApiImplicitParam(name = "id", value = "机构编号", dataType = "Long", required = true)
	@RequestMapping(value = "api/statistics/countUserNum/{id}", method = RequestMethod.POST)
	Map<String, Object> countUserNum(@PathVariable String id) {
		return statisticsService.countUserNum(id);
	}

	@ApiOperation(value = "使用单位（物业）过期电梯数", notes = "使用单位（物业）过期电梯数")
	@ApiImplicitParam(name = "id", value = "机构编号", dataType = "Long", required = true)
	@RequestMapping(value = "api/statistics/countOvertimeElevator/{id}", method = RequestMethod.POST)
	Map<String, Object> countOvertimeElevator(@PathVariable String id) {
		return statisticsService.countOvertimeElevator(id);
	}

	@ApiOperation(value = "年度乘客投诉处理的反馈 率", notes = "年度乘客投诉处理的反馈 率")
	@ApiImplicitParam(name = "id", value = "机构编号", dataType = "Long", required = true)
	@RequestMapping(value = "api/statistics/countFeedbackYear/{id}", method = RequestMethod.POST)
	Map<String, Object> countFeedbackYear(@PathVariable String id) {
		return statisticsService.countFeedbackYear(id);
	}

	@ApiOperation(value = "年度统计某个物业电梯总数，投诉，演练，救援,维保,维修", notes = "年度统计某个物业电梯总数，投诉，演练，救援,维保,维修")
	@ApiImplicitParam(name = "id", value = "机构编号", dataType = "Long", required = true)
	@RequestMapping(value = "api/statistics/countCountNum/{id}", method = RequestMethod.POST)
	Map<String, Object> countCountNum(@PathVariable String id) {
		return statisticsService.findCountCount(id);
	}

	@ApiOperation(value = "维保年度统计某个物业电梯总数，投诉，演练，救援,维保,维修", notes = "维保年度统计某个物业电梯总数，投诉，演练，救援,维保,维修")
	@ApiImplicitParam(name = "id", value = "机构编号", dataType = "Long", required = true)
	@RequestMapping(value = "api/statistics/findMaintCount/{id}", method = RequestMethod.POST)
	Map<String, Object> findMaintCount(@PathVariable String id) {
		return statisticsService.findMaintCount(id);
	}

	@ApiOperation(value = "维保单位今日维保", notes = "维保单位今日维保")
	@ApiImplicitParam(name = "id", value = "机构编号", dataType = "Long", required = true)
	@RequestMapping(value = "api/statistics/findTodayMaint/{id}", method = RequestMethod.POST)
	Map<String, Object> findTodayMaint(@PathVariable String id) {
		return statisticsService.findTodayMaint(id);
	}

	@ApiOperation(value = "本区域 使用单位各资质数量，汇总统计", notes = "本区域 使用单位各资质数量，汇总统计")
	@ApiImplicitParam(name = "id", value = "机构编号", dataType = "Long", required = true)
	@RequestMapping(value = "api/statistics/countUsedZz/{id}", method = RequestMethod.POST)
	Map<String, Object> countUsedZz(@PathVariable String id) {
		return statisticsService.countUsedZz(id);
	}

	@ApiOperation(value = "本区域 维保单位各资质数量，汇总统计", notes = "本区域 维保单位各资质数量，汇总统计")
	@ApiImplicitParam(name = "id", value = "机构编号", dataType = "Long", required = true)
	@RequestMapping(value = "api/statistics/countMaintZz/{id}", method = RequestMethod.POST)
	Map<String, Object> countMaintZz(@PathVariable String id) {
		return statisticsService.countMaintZz(id);
	}

	@ApiOperation(value = "辖区内 各类 应急救援发生的次数", notes = "辖区内 各类 应急救援发生的次数")
	@ApiImplicitParam(name = "id", value = "机构编号", dataType = "Long", required = true)
	@RequestMapping(value = "api/statistics/countRescueNum/{id}", method = RequestMethod.POST)
	Map<String, Object> countRescueNum(@PathVariable String id) {
		return statisticsService.countRescueNum(id);
	}

}
